<template>
	<view class="address-list-component">
		<view class="address-list">
			<view
				v-for="(item, index) in list"
				:key="index"
				class="address-item"
				:class="{
					disabled: item.status === '0' || !item.latitude || !item.longitude
				}"
				@click="$emit('choose', item)"
			>
				<view class="address-content">
					<view class="address-top">
						<view class="address-landmark">
							<view
								v-if="item.isDefault === '1' || !item.latitude || !item.longitude"
								class="address-tag"
							>
								<text v-if="!item.latitude || !item.longitude">失效</text>
								<text v-else-if="item.isDefault === '1'">默认</text>
							</view>
							<view class="landmark-text">{{ item.landmark }}{{ item.houseNumber }}</view>
						</view>
						<view class="address-edit" @click.stop="$emit('edit', item)">修改</view>
					</view>
					<view class="address-bottom">
						<view class="address-name">{{ item.userName }}</view>
						<view class="address-phone">{{ item.tel }}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		list: Array
	}
}	
</script>

<style lang="scss" scoped>
@import './index.scss';
</style>